<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
//var now=new Date();
//var end=new Date('0:0:0 5/1/2013');
	//	end.setFullYear(2013);
	//	end.setMonth(4);
	//	end.setDate(1);
	//	end.setHours(0);
	//	end.setMinutes(0);
	//	end.setSeconds(0);
//var time=(end.getTime()-now.getTime())/1000;
//var days=parseInt(time/(60*60*24));
//time%=60*60*24;
//var hours=parseInt(time/(60*60));
//	time%=60*60;
//var minutes=parseInt(time/60);
//	time%=60;
//var seconds=parseInt(time)
//
//alert('离51假期还有：'+days+'天'+hours+'小时'+minutes+'分'+seconds+'秒')

function times(){
	var arr=[];
	var now=new Date();
	var end=new Date('0:0:0 5/1/2013');
	var time=(end.getTime()-now.getTime())/1000;
	var days=parseInt(time/(60*60*24));
		arr.push(days)
		time%=60*60*24;
	var hours=parseInt(time/(60*60));
		arr.push(hours)
		time%=60*60;
	var minutes=parseInt(time/60);
		arr.push(minutes)
		time%=60;
	var seconds=parseInt(time)
		arr.push(seconds)
	return arr;
	
};
window.onload=function(){
	var div=document.getElementsByTagName('div')[0];
	setInterval(function(){
		arr=times();
		div.innerHTML='离51假期还有：'+arr[0]+'天'+arr[1]+'小时'+arr[2]+'分'+arr[3]+'秒'
	
	},1000)	
};
</script>
</head>

<body>
<div>

</div>
</body>
</html>
